import { makeClassInvoker } from 'awilix-koa';


class userApi {
  constructor({userService}) {
    this.userService = userService;
  }

  async getUserById(ctx) {
    return await this.userService.getUserById(ctx.params.id);
  }
}


export default function (router) {
  // Same trick as the functional API, but using `makeClassInvoker`.
  const api = makeClassInvoker(userApi);

  router.get('/api/v1/users/:id', api('getUserById'));

}
